<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>信加个人信用报告_住房公积金参缴记录</title>
    <style type="text/css">
        .searchArea .fieldBox .label{width: 70px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">信用报告ID</div>
                    <div class="field">
                        <input name="reportNo" id="reportNo" type="text" class="ui-textbox" value="">
                    </div>
                </div>

                <div class="clearFix"></div>
                <div class="btnsBox">
                    <span id="searchBtn" class="sq-button sq-button-round"></i>查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round"></i>清空</span>
                	<input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
    <div id="ligergrid1" class="sq-grid"></div>
</div>
<!-- 修改弹出框 -->
<div id="change_Html" style="display:none">
    <form id="change_form">
        <div class="fieldset1 tabel_col tabel_col_1 clearFix">
            <div class="fieldBox col_100">
                <div class="label">参缴地</div>
                <div class="field">
                    <input name="area" id="area" type="text" class="ui-textbox" value=""/>
                </div>
            </div>
            <div class="fieldBox col_100">
                <div class="label">单位缴存比例</div>
                <div class="field">
                    <input name="compercent" id="compercent" type="text" class="ui-textbox" value="" />
                </div>
            </div>
            <div class="fieldBox col_100">
                <div class="label">初缴月份</div>
                <div class="field">
                    <input name="firstmonth" id="firstmonth" type="text" class="ui-textbox" value=""/>
                </div>
            </div>
            <!-- <div class="fieldBox col_100">
                <div class="label">信息更新日期</div>
                <div class="field">
                    <input name="gettime" id="gettime" type="text" class="ui-textbox" value="">
                </div>
            </div> -->
            <div class="fieldBox col_100">
                <div class="label">缴费单位</div>
                <div class="field">
                    <input name="organname" id="organname" type="text" class="ui-textbox" value="">
                </div>
            </div>
            <div class="fieldBox col_100">
                <div class="label">个人缴存比例</div>
                <div class="field">
                    <input name="ownpercent" id="ownpercent" type="text" class="ui-textbox" value="" >
                </div>
            </div>
            <div class="fieldBox col_100">
                <div class="label">月缴存额</div>
                <div class="field">
                    <input name="pay" id="pay" type="text" class="ui-textbox" value="" >
                </div>
            </div>
            <div class="fieldBox col_100">
                <div class="label">缴费状态</div>
                <div class="field">
                    <input name="state" id="state" type="text" class="ui-textbox" value="" >
                </div>
            </div>
            <div class="fieldBox col_100">
                <div class="label">缴至月份</div>
                <div class="field">
                    <input name="tomonth" id="tomonth" type="text" class="ui-textbox" value="" >
                </div>
            </div>
        </div>
        <div class="btnsBox">
            <span id="saveChangeNew_Btn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_10"></i>保存</span>
        </div>
    </form>
</div>
<script type="text/javascript">
    var grid = null, callback=null;
    var addId = {
    		id:null,
    };
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/riskctrl/xjnpAccFund/initList.do',
            //delayLoad:true,
            method: 'get',
            columns: [
                {display: '报告编号ID', name: 'reportNo', minWidth: 130, align: 'center', enabledSort: false},
                {display: '参缴地', name: 'area', minWidth: 130, align: 'center', enabledSort: false},
                {display: '单位缴存比例', name: 'compercent', minWidth: 130, align: 'center', enabledSort: false},
                {display: '信息更新日期', name: 'firstmonth', minWidth: 130, align: 'center', enabledSort: false},
                {display: '缴费单位', name: 'organname', minWidth: 130, align: 'center', enabledSort: false},
                {display: '个人缴存比例', name: 'ownpercent', minWidth: 130, align: 'center', enabledSort: false},
                {display: '月缴存额', name: 'pay', minWidth: 130, align: 'center', enabledSort: false},
                {display: '参缴日期', name: 'registerdate', minWidth: 130, align: 'center', enabledSort: false},
                {display: '缴费状态', name: 'state', minWidth: 130, align: 'center', enabledSort: false},
                {display: '缴至月份', name: 'tomonth', minWidth: 130, align: 'center', enabledSort: false},
                
                {
                    display: '操作', name: '', minWidth: 150, align: 'left', enabledSort: false,
                    render: function (rowdata, rowindex, value){
                    	var h='<a class="sq-button-hasicon" href="javascript:toMfrModify(';
	            		h+="'"+rowdata.id+"'";
	                    h+=')"><i class="sqBtnIco_4"></i>修改</a>';
	            		var d='<a class="sq-button-hasicon" href="javascript:deleteRecord(';
		            		d+="'"+rowdata.id+"'";
		                    d+=')"><i class="sqBtnIco_7"></i>删除</a>';
	                	return h + d;
                    }
                }
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            rownumbers:true,
            frozen: false,
            allowUnSelectRow: true,
            alternatingRow: false,
            onBeforeShowData: function ()
            {
                //var grid = this;
                //grid.collapsedRows = [];
            }
        });
        grid.setHeight(100);

        $("#searchBar").ligerForm();

        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });
        
        /* 清空 */
        $("#clearBtn").click(function (event) {
            $("#resetBtn").click();  //重置 input-text
            $("#resetBtn").click();
        });
        callback = function () {
            grid.reload();
        };
        $("#saveChangeNew_Btn").click(function(event) {
        	var forms = liger.get("change_form");
            if (!forms.valid()) {
            	$.ligerDialog.SQalert({content:LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            var _params = forms.getData();
            $.extend(true, _params, addId);
            var wait_dialog;
    		$.ligerDialog.hide();
    		$.ajax({
    			type: 'get',
    			dataType:'json',
    			data:_params,
    			url: '<%=path%>/riskctrl/xjnpAccFund/modify.do',
    			beforeSend:function(){
    				wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
    			},
    			success:function(msg){
    				wait_dialog.close();
    				if(msg.success == 1){
    					$.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
    					grid.reload();
    				 }else{
    					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
    				 }
    			}
    		}); 
        });
    });
    
  function deleteRecord(id){
	  if(!id)return;
	  var isDel = 1;
	  $.ligerDialog.confirm('确定删除吗?', function (flag) {
          if (flag == false)return;
		  $.ajax({
			  type:'POST',
			  dataType:'json',
			  data:{id:id,isDel:isDel},
			  url:'<%=path%>/riskctrl/xjnpAccFund/modify.do',
				beforeSend : function() {
					wait_dialog = $.ligerDialog.SQalert({
						content : LogUtils.LOG_CMM_DATA_LOADING,
						SQ_type : "waitting"
					});
				},
				success : function(msg) {
					wait_dialog.close();
					if (msg.success == 1) {
						$.ligerDialog.SQalert({
							content : msg.info,
							SQ_type : "success"
						});
						grid.reload();
					} else {
						$.ligerDialog.SQalert({
							content : msg.info,
							SQ_type : "error"
						});
					}
				}
			});
	    });
	}
  function toMfrModify(id){
		if(!id)return;
		$.ajax({
			type: 'get',
			dataType:'json',
			data:{id:id},
			url: '<%=path%>/riskctrl/xjnpAccFund/getById.do',
			success:function(msg){
				if(msg.success == 1){
					openChange();//弹出修改框
					setData(msg.data);//设置数据
					addId.id = id;
				 }else{
					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
				 }
			}
		});
	}
	function openChange(){
		$.ligerDialog.open({
	        width: 400,
	        top: 100,
	        title : '修改信息',
	        target: $("#change_Html"),
	        onHideDialog: function () {
	            clearLigerForm("change_form");
	        }
	    });
		$("#change_form").ligerForm({validate: true});
	}
	function setData(data){
		var form = new liger.get("change_form");
		form.setData({
			id:data.id,
			area:data.area,
			compercent:data.compercent,
			firstmonth:data.firstmonth,
			organname:data.organname,
			ownpercent:data.ownpercent,
			pay:data.pay,
			state:data.state,
			tomonth:data.tomonth
		});
	}
</script>

</body>
</html>
